#include<bits/stdc++.h>
using namespace std;
int a[10000];
void an(int t){
    int x = (((128 + 321 +232 +  a[t] * 7 - 2 +313+901)-3 *a[t] ))&(432)%123

}

int main(){
    freopen("arena.in", "r", stdin);
    freopen("arena.out", "w", stdout);

    int t;
    int i =0;
    while(cin>>a[i]){
        i++;
    }
    cin>>t;
    while(t--){

        an(t);

    }

    return 0;

}
